#include<bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
int n,a[N][5];
int dp[N][5];
signed main()
{
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i][1]>>a[i][2]>>a[i][3];
	for(int i=1;i<=n;i++) dp[i][1]=max(dp[i-1][2]+a[i][1],dp[i-1][3]+a[i][1]), dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][3]+a[i][2]), dp[i][3]=max(dp[i-1][1]+a[i][3],dp[i-1][2]+a[i][3]);
	int ans=max(dp[n][1],max(dp[n][2],dp[n][3]));
	cout<<ans;
	return 0;
}
